<%@ taglib prefix="c" uri="http://www.codecoord.com" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>病例详情</title>
    <script src="${pageContext.request.contextPath}/static/jquery/jquerymin.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/src/css/layui.css">
    <script src="${pageContext.request.contextPath}/static/layui/js/layui-2.6.8.js"></script>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap-min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.css">
    <script src="${pageContext.request.contextPath}/static/js/axios-min.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/live_meeting.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/case_show.css">
    <style>
        body {
            background: #F0F2F5;
        }

        #navbar-default {
            background-color: #71BD71;
        }
        .aui-footer-fixed{
            display: none;
        }
    </style>
</head>
<body>
<div id="header">
    <nav id="navbar-default" class="navbar navbar-default top-nabar" role="navigation"
         style="overflow:hidden;position:fixed;top:0;width:100%;z-index:1002;border: 0">
        <div class="row">
            <div class="container-fluid" id="fluid">
                <div class="col-lg-1 col-md-1 col-xs-1 col-sm-1" style=";padding-left: 6px;">
                    <a class="navbar-brand" href="javascript:history.back(-1)"
                       style="padding-left: 3px;">
                        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    </a>
                </div>
            </div>
        </div>
    </nav>
    <br><br>
</div>

<div id="first_div"></div>
<div id="second_div"></div>
<div class="main">
    <div id="show_1">
        <span id="span_1">${appointmentCase_2[0].title}</span>
        <i class="layui-icon layui-icon-next"></i>
        <span id="span_2" onclick="buhuo()">涉及疾病:</span>
        <p class="jibing" style="top: 28%;overflow: hidden">${appointmentUser_2.content}</p>
        <span>涉及科室:</span>
        <p class="keshi" style="top: 47%;">${appointmentUser_2.majors}</p>
        <span style="width: 20%">病例文件:</span>
        <c:forEach items="${appointmentCase_2}" var="appointmentCase_2" varStatus="status">
        <a href="" id="a_${status.index+1}" style="display: none">${appointmentCase_2.fileName}</a>
        </c:forEach>
        <span>病例数量:</span>
        <p style="top: 85.5%">${appointmentCase_2.size()}</p>
    </div>

    <form class="layui-form" action="">
        <div class="layui-tab" lay-filter="case">
            <ul class="layui-tab-title">
                <li value="0" class="layui-this" onclick="selectcase(value)">病例1</li>
                <c:forEach items="${appointmentCase_2}" var="appointmentCase_2" varStatus="status">
                    <li value="${status.index}" onclick="selectcase(${status.index+1})">病例${status.index+2}</li>
                </c:forEach>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-tab-content_1_1">
                        <span id="miaoshu_span">病例描述:</span>
                        <i  onclick="Slippage()" class="layui-icon layui-icon-down"></i>
                        <button id="button_1" type="button" onclick="copyall()" class="layui-btn layui-btn-radius">复制全部</button>
                        <div class="layui-input-block" style="margin-left:0;width: 100%">
                            <textarea id="text_1" placeholder="暂无描述" class="layui-textarea" disabled="disabled"></textarea>
                        </div>
                    </div>
                    <div class="layui-tab-content_1_2">
                        <span id="miaoshu_span_2">治疗及康复建议:</span>
                        <div class="layui-input-block" style="margin-left:0;width: 100%">
                            <textarea id="text_2" placeholder="暂无建议" class="layui-textarea" disabled="disabled"></textarea>
                        </div>
                    </div>
                    <%--复制文本使用,隐藏--%>
                    <textarea id="text_3" placeholder="" class="layui-textarea" style="opacity:0;"></textarea>
                </div>
            </div>
        </div>
    </form>
</div>
<footer class="aui-footer aui-footer-fixed">

    <a href="/boke/index.jsp" class="aui-tabBar-item " style="text-decoration:none;">
        <span class="aui-tabBar-item-icon"><i class="icon icon-loan"></i></span>
        <span class="aui-tabBar-item-text">首页</span></a>
    <a href="/bokehall/hall/allHall" class="aui-tabBar-item aui-tabBar-item-active">
        <span class="aui-tabBar-item-icon"><i class="icon icon-credit"></i></span>
        <span class="aui-tabBar-item-text">会诊</span></a>

    <a href="/boke/msg/chatfriend.jsp" class="aui-tabBar-item ">
        <span class="aui-tabBar-item-icon"><i class="icon icon-ions"></i></span>
        <span class="aui-tabBar-item-text">消息</span></a>

    <a href="/boke/me.jsp" class="aui-tabBar-item "><span
            class="aui-tabBar-item-icon"><i class="icon icon-mine"></i></span>
        <span
                class="aui-tabBar-item-text">我的
        </span></a>
</footer>
</body>
<script>
    $(document).ready(function () {
        $("#header").hide(); //隐藏导航栏
        $("#first_div").css("margin-top","0")//隐藏导航栏
        $(".layui-tab-title li:last").remove();
        selectcase(0);
    })

    //切换tab选项,动态切换下方数据,切换病例文件
    function selectcase(index) {
        //切换病例文件状态
        $("#show_1>a").css('display', 'none');
        $("#a_" + (index + 1)).css('display', 'block')
        let array2 = new Array();
        let b = 0;
        <c:forEach items="${appointmentCase_2}" var="appointmentCase_2">
        array2.push({
            index: b,
            expertAdvice: '${appointmentCase_2.expertAdvice}',
            caseDescription: '${appointmentCase_2.caseDescription}'
        })
        b++;
        </c:forEach>
        $("#text_1").val(array2[index].expertAdvice)
        $("#text_2").val(array2[index].caseDescription);
        layui.use(['form', 'upload', 'layer'], function () {
            layui.form.render("textarea");
        })
    }
    //复制全部文本到剪切板
    function copyToClipboard(elem) {
        var targetId = "_hiddenCopyText_";
        var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
        var origSelectionStart, origSelectionEnd;
        if (isInput) {
            target = elem;
            origSelectionStart = elem.selectionStart;
            origSelectionEnd = elem.selectionEnd;
        } else {
            target = document.getElementById(targetId);
            if (!target) {
                var target = document.createElement("textarea");
                target.style.position = "absolute";
                target.style.left = "-9999px";
                target.style.top = "0";
                target.id = targetId;
                document.body.appendChild(target);
            }
            target.textContent = elem.textContent;
        }
        var currentFocus = document.activeElement;
        target.focus();
        target.setSelectionRange(0, target.value.length);
        var succeed;
        try {
            succeed = document.execCommand("copy");
        } catch (e) {
            succeed = false;
        }
        if (currentFocus && typeof currentFocus.focus === "function") {
            currentFocus.focus();
        }
        if (isInput) {
            elem.setSelectionRange(origSelectionStart, origSelectionEnd);
        } else {
            target.textContent = "";
        }
        return succeed;
    }
    //点击复制,并且将两个文本框数据合并
    function copyall() {
        let t1=$("#text_1").val();
        let t2=$("#text_2").val();
        let textareaAll = new Array();
        textareaAll.push("病例描述:"+t1+"。"+'\n'+'\n'+"治疗建议:"+t2+"。");
        $("#text_3").val(textareaAll);
        copyToClipboard(document.getElementById("text_3"));
        layer.msg('复制成功',{time:1000});
    }
    function Slippage() {
        document.getElementById('text_1').scrollTop = document.getElementById('text_1').scrollHeight;
    }
    //捕获页
</script>
</html>
